<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>老师登记</title>
	<meta name="decorator" content="ani"/>
	<style>
		.select-disabled {
			pointer-events: none;
			background-color: #eeeeee;
		}
	</style>
	<script type="text/javascript">

		$(document).ready(function() {
			jp.ajaxForm("#inputForm",function(data){
				if(data.success){
				    jp.success(data.msg);
					jp.go("${ctx}/buzz/teacher/teacher");
				}else{
				    jp.error(data.msg);
				    $("#inputForm").find("button:submit").button("reset");
				}
			});

			$("#inputForm").find("select").each(function () {
				if ($(this).attr("data-value") != '' && $(this).attr("data-value") != undefined) {
					$(this).val($(this).attr("data-value"));
				}
			});


			$('#begindate').datetimepicker({
				format: "YYYY-MM-DD"
			});

			$('#enddate').datetimepicker({
				format: "YYYY-MM-DD"
			});
		});
	</script>
</head>
<body>

<div class="wrapper wrapper-content">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-primary">
				<div class="panel-heading">
					<h3 class="panel-title">
						<a class="panelButton" href="${ctx}/buzz/teacher/teacher"><i class="ti-angle-left"></i> 返回</a>
					</h3>
				</div>
				<div class="panel-body">
					<form:form id="inputForm" modelAttribute="teacher" action="${ctx}/buzz/teacher/teacher/save" method="post" class="form-horizontal">
						<form:hidden path="id"/>
						<form:hidden path="classid"/>
						<form:hidden path="company.id"/>
					<fieldset class="well-new">
						<legend><i style="padding: 0px 5px 0px 5px" aria-hidden="true"></i>基本信息</legend>
						<div class="form-group">
							<label class="col-sm-2 col-md-1 control-label">老师姓名：</label>
							<div class="col-sm-10 col-md-2">
								<form:input path="name" htmlEscape="false"    class="form-control "/>
							</div>
							<label class="col-sm-2 col-md-1 control-label">性别：</label>
							<div class="col-sm-10 col-md-2">
								<form:select path="sex" class="form-control " data-value="${teacher.sex}">
									<form:option value="" label=""/>
									<form:options items="${fns:getDictList('Sys_XingBie')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
								</form:select>
							</div>
							<label class="col-sm-2 col-md-1 control-label">电话：</label>
							<div class="col-sm-10 col-md-2">
								<form:input path="tel" htmlEscape="false"    class="form-control "/>
							</div>
							<label class="col-sm-2 col-md-1 control-label">职务：</label>
							<div class="col-sm-10 col-md-2">
								<select id="position" name="position.id" class="form-control m-b required" data-value="${teacher.position.id}">
									<option value=""></option>
									<c:forEach items="${fns:getSelectList('','','bt_base','name','classid|教室职务' )}" var="dict">
										<option value="${dict.id}">${dict.name}</option>
									</c:forEach>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 col-md-1 control-label">身份证号：</label>
							<div class="col-sm-10 col-md-2">
								<form:input path="card" htmlEscape="false"    class="form-control "/>


							</div><label class="col-sm-2 col-md-1 control-label">合同开始日期：</label>
							<div class="col-sm-10 col-md-2">
								<div class='input-group form_datetime' id='begindate'>
									<input type='text' name="begindate" class="form-control " value="<fmt:formatDate value="${teacher.begindate}" pattern="yyyy-MM-dd"/>"/>
									<span class="input-group-addon">
										<span class="glyphicon glyphicon-calendar"></span>
									</span>
								</div>
							</div>
							<label class="col-sm-2 col-md-1 control-label">合同结束日期：</label>
							<div class="col-sm-10 col-md-2">
								<div class='input-group form_datetime' id='enddate'>
									<input type='text' name="enddate" class="form-control " value="<fmt:formatDate value="${teacher.enddate}" pattern="yyyy-MM-dd"/>"/>
									<span class="input-group-addon">
										<span class="glyphicon glyphicon-calendar"></span>
									</span>
								</div>
							</div>
							<label class="col-sm-2 col-md-1 control-label">教室：</label>
							<div class="col-sm-10 col-md-2">
								<select id="room" name="room.id" class="form-control m-b required" data-value="${teacher.room.id}">
									<option value=""></option>
									<c:forEach items="${fns:getSelectList('','','bt_base','name','classid|教室管理' )}" var="dict">
										<option value="${dict.id}">${dict.name}</option>
									</c:forEach>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 col-md-1 control-label">备注：</label>
							<div class="col-sm-10 col-md-11">
								<form:textarea path="remarks" htmlEscape="false" rows="4"    class="form-control "/>
							</div>
						</div>
					</fieldset>
					<c:if test="${mode == 'add' || mode=='edit'}">
							<div class="col-lg-3"></div>
							<div class="col-lg-6">
								 <div class="form-group text-center">
									 <div>
										 <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
									 </div>
								 </div>
							</div>
					</c:if>
		</form:form>
		</div>
	</div>
	</div>
</div>
</div>
</body>
</html>
